package com.gin.pixiv.api

import com.gin.pixiv.enums.WorkType
import com.gin.pixiv.param.bookmark.*
import com.gin.pixiv.response.PixivResponse
import com.gin.pixiv.response.bookmark.BookmarkAddBody
import com.gin.pixiv.response.tag.RenameTagEstimate
import com.gin.pixiv.response.tag.RenameTagProgress
import com.gin.retrofit.annotation.StaticField
import retrofit2.Call
import retrofit2.http.*

/**
 * 收藏作品管理API,只能对自己的收藏使用
 * @author bx002
 * @since 2024/2/19 14:29
 */
interface BookmarkManageApi {
    /**
     * 添加绘画收藏
     * @param param IllustAddParam
     * @return Call<PixivResponse<BookmarkAddBody>>
     */
    @POST("ajax/illusts/bookmarks/add")
    fun postIllustAdd(@Body param: IllustAddParam): Call<PixivResponse<BookmarkAddBody>>

    /**
     * 添加小说收藏
     * @param param NovelAddParam
     * @return Call<PixivResponse<Long>>
     */
    @POST("ajax/novels/bookmarks/add")
    fun postNovelAdd(@Body param: NovelAddParam): Call<PixivResponse<Long>>

    /**
     * 批量删除收藏(推荐)
     */
    @POST("ajax/{type}/bookmarks/remove")
    fun postDelete(
        @Path("type") type: WorkType,
        @Body param: BookmarkDelParam,
    ): Call<PixivResponse<Void>>

    /**
     * 删除单个绘画收藏(不推荐)
     */
    @FormUrlEncoded
    @POST("ajax/illusts/bookmarks/delete")
    fun postDeleteIllusts(@Field("bookmark_id") bookmarkId: Long): Call<PixivResponse<Void>>

    /**
     * 删除单个小说收藏(不推荐)
     */

    @FormUrlEncoded
    @POST("ajax/novels/bookmarks/delete")
    @StaticField("del", "1")
    fun postDeleteNovels(@Field("book_id") bookmarkId: Long): Call<PixivResponse<Void>>

    /**
     * 查询重命名收藏标签的进度
     */
    @GET("ajax/{type}/bookmarks/rename_tag_progress")
    fun getRenameTagProgress(
        @Path("type") type: WorkType,
    ): Call<PixivResponse<RenameTagProgress>>

    /**
     * 预估重命名收藏标签需要的时长
     */
    @POST("ajax/{type}/bookmarks/rename_tag_estimate")
    fun postRenameTagEstimate(
        @Path("type") type: WorkType,
        @Body param: RenameTagEstimateParam,
    ): Call<PixivResponse<RenameTagEstimate>>

    /**
     * 重命名标签
     */
    @POST("ajax/{type}/bookmarks/rename_tag")
    fun postRenameTag(
        @Path("type") type: WorkType,
        @Body param: RenameTagParam,
    ): Call<PixivResponse<Void>>

    /**
     * 批量修改收藏作品的公开性
     */
    @POST("ajax/{type}/bookmarks/edit_restrict")
    fun postEditRestrict(
        @Path("type") type: WorkType,
        @Body param: EditRestrictParam,
    ): Call<PixivResponse<Void>>

    /**
     * 批量为收藏作品添加收藏标签
     */
    @POST("ajax/{type}/bookmarks/add_tags")
    fun postAddTags(
        @Path("type") type: WorkType,
        @Body param: AddTagsParam,
    ): Call<PixivResponse<Void>>


}